package slave;

import java.io.IOException;

class MasterChannelCall {
	private MasterChannel channel;
	private String[] params;
	private String operation;

	MasterChannelCall(MasterChannel channel, String operation, String[] params) {
		if (channel == null) {
			throw new NullPointerException("channel");
		}
		if (operation == null) {
			throw new NullPointerException("operation");
		}
		
		if (params == null) {
			throw new NullPointerException("params");
		}
		this.channel = channel;
		this.operation = operation;
		this.params = params;
	}

	public String[] getParams() {
		return params;
	}
	public String getOperation() {
		return operation;
	}
	
	public void returns(String ret) throws IOException {
		String output = (ret == null ? "" : ret) + "\r\n";
		this.channel.getOutput().writeBytes(output);
	}
}
